<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增确认收款')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-qrsk-add">
        	<input type="hidden" name="gcProjectid" id="gcProjectid" th:value="${sqkp.gcProjectid}">
        	<input type="hidden" name="sqkpId" id="sqkpId" th:value="${sqkp.id}">
        	<div class="form-group">    
                <label class="col-sm-3 control-label is-required">项目名称：</label>
                <div class="col-sm-8">
                    <input name="projectName" id="projectName" th:value="${sqkp.xmmc}" class="form-control" type="text" readonly="readonly" autoComplete="off" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">合同金额：</label>
                <div class="col-sm-8">
                    <input name="htje" class="form-control" type="text" autoComplete="off" readonly="readonly" th:value="${#numbers.formatDecimal(sqkp.htje, 3, 2)}" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">开票金额：</label>
                <div class="col-sm-8">
                    <input name="bcsqkpje" id="bcsqkpje" class="form-control" type="text" autoComplete="off" readonly="readonly" th:value="${#numbers.formatDecimal(sqkp.itemje, 3, 2)}" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">确认收款金额：</label>
                <div class="col-sm-8">
                	<input name="qrjine1" id="qrjine1" type="hidden" th:value="${qrjine}">
                    <input name="qrjine" id="qrjine" class="form-control" type="text" autoComplete="off" required th:value="${#numbers.formatDecimal(qrjine, 3, 2)}">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">收款类型：</label>
                <div class="col-sm-8">
                    <select name="type" class="form-control" th:with="type=${@dict.getType('gcgl_qrsk_type')}" required>
					  <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}">
					  </option>
					</select>
                </div>
            </div>
            <div class="form-group">
            	<label class="col-sm-3 control-label is-required">收款时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="skAt" class="form-control" placeholder="yyyy-MM-dd" type="text" autoComplete="off" required>
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">付款单位：</label>
                <div class="col-sm-8">
                    <input name="fkdw" id="fkdw" th:value="${sqkp.shuih}" class="form-control" type="text" autoComplete="off" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">付款银行：</label>
                <div class="col-sm-8">
                    <input name="fkyh" id="fkyh" th:value="${sqkp.kaihuh}" class="form-control" type="text" autoComplete="off" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">收款单位：</label>
                <div class="col-sm-8">
                    <input name="skdw" id="skdw" class="form-control" type="text" autoComplete="off" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">收款银行：</label>
                <div class="col-sm-8">
                    <input name="skyh" id="skyh" class="form-control" type="text" autoComplete="off" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">归属公司：</label>
                <div class="col-sm-8">
                    <input name="dept" id="dept" class="form-control" type="text" autoComplete="off" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-8">
                    <textarea name="memo" class="form-control"></textarea>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script th:inline="javascript">
        var prefix = ctx + "gcgl/qrsk"
        $("#form-qrsk-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
            	if(Number($("#qrjine").val())<=Number($("#qrjine1").val())){
            		$.operate.save(prefix + "/add", $('#form-qrsk-add').serialize());
            	}else{
            		$.modal.alertWarning("确认收款金额不能大于："+$("#qrjine1").val());
            	}
            }
        }
        
        $("input[name='skAt']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

    </script>
</body>
</html>